package cn.ject.mcpserver.service;

import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Service;

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;

/**
 * @author Administrator
 */
@Service
public class WeatherService {

    @Tool(description = "通过城市名字获取温度")
    public String getWeather(@ToolParam(description = "城市名称") String city) throws UnsupportedEncodingException {
        String desCityName = new String(city.getBytes("GBK"), StandardCharsets.UTF_8);
        return desCityName + "今天的温度是" + desCityName.length() * 10;
    }


}
